package com.nineclock.approve.handler;

import com.alibaba.fastjson.JSONObject;
import org.activiti.bpmn.model.EndEvent;
import org.activiti.bpmn.model.Process;
import org.springframework.stereotype.Component;

/**
 * 结束节点处理器
 */
@Component
public class EndNodeResolver extends ProcessNodeResolver{

    private static String type = "end"; // 节点类型

    public boolean support(String nodeType) {
        return nodeType.equals(type);
    }

    @Override
    public void addFlowNodeToActiviti(Process process, JSONObject curNode, JSONObject nextNode) {
        EndEvent endEvent = new EndEvent();
        endEvent.setId(getNodeId(curNode));
        endEvent.setName(curNode.getString("name"));
        process.addFlowElement(endEvent);
    }
}
